Vito'sfamily
T=input()
for t in range(int(T)):
a=list(map(int,input().split()))
a=sorted(a[1:])
m=a[len(a)//2]
sum=0
for i in a:
sum+=abs(i-m)
print(sum)
Hashmat the brave warrior
while 1:
try:
a,b=map(int,input().split())
print(abs(a-b))
except:
break